package top.lixunda.ecommerce.server.user.api.entity.db;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 权限分配表，将存在的权限分配给用户，角色或者菜单
 * </p>
 *
 * @author Lixunda
 * @since 2020-04-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("permission_allot")
@ApiModel(value = "PermissionAllotDO对象", description = "权限分配表，将存在的权限分配给用户，角色或者菜单")
public class PermissionAllotDO extends Model<PermissionAllotDO> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "权限分配编号，唯一主键")
    @TableId(value = "allot_id", type = IdType.AUTO)
    private Integer allotId;

    @ApiModelProperty(value = "权限编号")
    @TableField("permission_id")
    private Integer permissionId;

    @ApiModelProperty(value = "分配对象，用户，角色，菜单")
    @TableField("allot_part")
    private String allotPart;

    @ApiModelProperty(value = "对象编号，用户编号，角色ID，菜单ID")
    @TableField("part_id")
    private Integer partId;

    @ApiModelProperty(value = "分配模式，手动分配和自动分配")
    @TableField("allot_mode")
    private String allotMode;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人员编号")
    @TableField("create_user_id")
    private Integer createUserId;

    @ApiModelProperty(value = "创建人员名称")
    @TableField("create_user_name")
    private String createUserName;

    @ApiModelProperty(value = "创建人员类型")
    @TableField("create_user_type")
    private String createUserType;

    @ApiModelProperty(value = "删除人员编号")
    @TableField("remove_user_id")
    private Integer removeUserId;

    @ApiModelProperty(value = "删除人员名称")
    @TableField("remove_user_name")
    private String removeUserName;

    @ApiModelProperty(value = "删除人员类型")
    @TableField("remove_user_type")
    private String removeUserType;

    @ApiModelProperty(value = "删除时间")
    @TableField("remove_time")
    private LocalDateTime removeTime;

    @ApiModelProperty(value = "逻辑删除字段")
    @TableField("usable")
    @TableLogic
    @JsonIgnore
    private Integer usable;


    @Override
    protected Serializable pkVal() {
        return this.allotId;
    }

}
